﻿<style type="text/css">
    .img50 { width: 50px; height: 50px; }
    .img80 { width: 80px; height: 80px; }
    .staricon { font-size: 1.2em; color: #ccc; cursor: pointer; }
    .staricon.fa-star { color: #FBA507; }
    .comments-header { border: 1px solid #ddd; padding: 0 20px; background: #f7f7f7; height: 30px; line-height: 30px; }
    .sphead { text-align: center; font-weight: 700; display: inline-block; }
    .column1 { width: 48%; }
    .column2 { width: 15%; text-align: left; }
    .column3 { width: 15%; }
    .column4 { width: 20%; text-align: left; }
    /*回复主列表 上右下左*/
    .com-item-main { width: 100%; }
    .comments-item { padding: 10px 20px 10px 20px; margin-top: -1px; border: 1px solid #ddd; font-size: 12px; color: #666; }
    .comments-item .time { color: #999; font-weight: 400; font-size: 12px; display: inline-block; }
    .comments-item .user-item { padding-bottom: 3px; }
    .comments-item .user_group { color: #088000; margin-left: 10px; }
    .comments-item .p-imgs { margin-top: 5px; }
    .comments-item .imgsp { padding: 3px; margin-right: 3px; display: inline-block; border: 1px solid #ddd; cursor: pointer; }
    .comments-item .imgsp:hover { border: 1px solid #31708f; }
    .comments-item .comment-operate { padding-top: 2px; padding-bottom: 3px; }
    .comments-item .reply-trigger { cursor: pointer; color: #999; }
    .comments-item .reply-operate { display: none; margin-top: 5px; text-align: right; background: #f7f7f7; padding: 10px 10px 15px; border: 1px solid #ddd; }
    /*回复列表*/
    .comment-reply-item { border-top: 1px dotted #ccc; padding: 10px 0 10px 15px; }
</style>
<script src="/JS/ZL_Regex.js"></script>
<script src="/js/jquery.rotate.min.js"></script>
<script src="/JS/mvcpage.js"></script>
<script>
    $(function () {
        //绑定触发回复
        $(".reply-trigger").click(function () {
            var msgmod = $(this).data("info");
            $(".reply-operate").hide();
            $("#reply_operate_" + msgmod.id).show();
            $("#reply_msg_" + msgmod.id).attr("placeholder", "回复  " + msgmod.uname + " :");
            replyconf.curmod = msgmod;
        });
        //点击浏览大图
        $(".imgsp").click(function () {
            ShowImgView(this);
        });
        //如果翻页,返回锚点
        var cpage = "@Model.cpage";
        if (cpage > 1 && parent.commentAnchor) {
            //function commentAnchor() { $("html,body").animate({ scrollTop: $("#iframe_comm").offset().top-100 }, 300); }
            parent.commentAnchor();
        }
        //绑定删除操作
        $(".del-trigger").click(function () {
            if (confirm("是否删除该评论?")) {
                var id = $(this).data("id");
                var self = $(this);
                $.post("", { action: "del", id: id }, function (data) {
                    if (data == 1) {
                        window.location = location;
                    }
                });
            }
        });
    })
    var replyconf = { psize: 5, curmod: null };
    //提交回复
    function ReplyTo()//回复的主信息id,被回复信息id
    {
        var id = replyconf.curmod.id;
        var rid = replyconf.curmod.rid;
        var msg = $("#reply_msg_" + id).val();
        //-----------
        if (ZL_Regex.isEmpty(msg)) { alert("回复内容不能为空"); return false; }
        $("#reply_msg_" + id).val("");
        $.post("/User/Order/Share_API", { action: "reply", "msg": msg, "id": id, "rid": rid, proid: '@Request.QueryString["ProID"]' }, function (data) {
            if (data == 1) { mvcpage.load({ "target": "EGV" + rid, "page": "first", "url": "@(Request.RawUrl)", "pid": id }); }
        });
        $(".reply-operate").hide();
    }
    function HideReply() {
        $(".reply-trigger").hide();
    }
    //-----图片处理
    var curPreImg;//当前预览图
    function Collapse(id) {
        DisPreView(event.srcElement);
    }
    //隐藏预览视图
    function DisPreView(obj) {
        $obj = $(obj).parent().parent().parent();
        $obj.hide().siblings(".subtitle").find("img").show();
        $obj.find(".view_preimg").unbind('click');
        $obj.find(".view_nextimg").unbind('click');
    }
    function ShowImgView(obj) {
        clearCurPreImg();
        curPreImg = event.srcElement;
        //var pobj = $(event.srcElement).closest(".subtitle");
        //var id = pobj.attr("data-id");
        //pobj.find("img").hide();
        var $img = $(obj).find("img");
        var id = $(obj).closest(".comments-item").data("id");
        $("#view_img_" + id).attr("src", $img.attr("src"));
        $("#view_div_" + id).show();
        $("#view_div_" + id).find(".view_preimg").click(function () { eachImg(id, 0) });
        $("#view_div_" + id).find(".view_nextimg").click(function () { eachImg(id, 1); });
        checkNextImg(id);
    }
    //清空当前预览视图
    function clearCurPreImg() {
        if (!curPreImg) return;
        var pobj = $(curPreImg).closest(".subtitle");
        var id = pobj.attr("data-id");
        DisPreView($("#view_img_" + id));
    }
    //检查是否还有下一张(上一张)图片
    function checkNextImg(id) {
        var $li = $(curPreImg).parent();
        if (!$li.next()[0])
            $("#view_div_" + id).find(".view_nextimg").hide();
        else
            $("#view_div_" + id).find(".view_nextimg").show();
        if (!$li.prev()[0])
            $("#view_div_" + id).find(".view_preimg").hide();
        else
            $("#view_div_" + id).find(".view_preimg").show();
    }
    function RoteImg(id, direct) {
        var angle = 0;
        if (direct == "left")
            angle = $('#' + id).data("angle") - 90;
        else
            angle = $('#' + id).data("angle") + 90;
        $('#' + id).data("angle", angle);
        $('#' + id).rotate(angle);
    }
    //--------------------------
</script>